package com.zyk.leetcode;

/**
 * @author zhangsan
 * @date 2021/4/9 17:48
 */
public class M0506 {

    // https://leetcode-cn.com/problems/convert-integer-lcci/
    public static int convertInteger(int A, int B) {
        int ans = 0;
        for (int i = 0; i < 32; i++) {
            ans += (A >> i & 1) != (B >> i & 1)? 1: 0;
        }
        return ans;
    }


    // for test
    public static void main(String[] args) {
        int A = 1;
        int B = 2;
        System.out.println(convertInteger(A, B));
    }

}
